﻿using EPiServer;
using EPiServer.DynamicContent;
using SocialPack.modules.SocialPack.Widgets.Twitter;

namespace SocialPack.modules.SocialPack.DynamicContent.Twitter
{
    [DynamicContentPlugIn(
        DisplayName = "Twitter Tweet Button",
        Description = "Displays Twitter Tweet Button",
        ViewUrl = "~/modules/socialpack/dynamiccontent/twitter/tweetbutton.ascx")]
    public partial class TweetButton : UserControlBase
    {
        public string Language { get; set; }

        public string TwitterName { get; set; }

        public string Text { get; set; }

        public Count Count { get; set; }

        protected override void OnLoad(System.EventArgs e)
        {
            base.OnLoad(e);

            if (!string.IsNullOrWhiteSpace(this.Language))
            {
                this.TweetButtonControl.Language = this.Language;
            }

            if (!string.IsNullOrWhiteSpace(this.TwitterName))
            {
                this.TweetButtonControl.TwitterName = this.TwitterName;
            }

            if (!string.IsNullOrWhiteSpace(this.Text))
            {
                this.TweetButtonControl.Text = this.Text;
            }

            this.TweetButtonControl.Count = this.Count;
        }
    }
}